package com.amos.cmp_android.ui;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageButton;
import android.widget.Toast;

import com.amos.cmp_android.R;

public class MainActivity extends AppCompatActivity {

    private View.OnClickListener onClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if(v.getId() == R.id.bt_news){
                startActivity(new Intent(MainActivity.this, NewsActivity.class));
            }else if(v.getId() == R.id.bt_school_bus){
                startActivity(new Intent(MainActivity.this,SchoolBusActivity.class));
            }else if(v.getId() == R.id.bt_notebook){
                startActivity(new Intent(MainActivity.this, YellowPageActivity.class));
            }else if(v.getId() == R.id.bt_teacher){
                startActivity(new Intent(MainActivity.this, TeacherActivity.class));
            }else if(v.getId() == R.id.bt_email){
                startActivity(new Intent(MainActivity.this, EmailActivity.class));
            }
        }
    };

    private ImageButton iBNews;
    private ImageButton iBSchoolBus;
    private ImageButton iBNotebook;
    private ImageButton iBTeacher;
    private ImageButton iBEmail;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        iBNews = (ImageButton) findViewById(R.id.bt_news);
        iBSchoolBus = (ImageButton) findViewById(R.id.bt_school_bus);
        iBNotebook = (ImageButton) findViewById(R.id.bt_notebook);
        iBTeacher = (ImageButton) findViewById(R.id.bt_teacher);
        iBEmail = (ImageButton) findViewById(R.id.bt_email);

        iBNews.setOnClickListener(onClickListener);
        iBSchoolBus.setOnClickListener(onClickListener);
        iBNotebook.setOnClickListener(onClickListener);
        iBTeacher.setOnClickListener(onClickListener);
        iBEmail.setOnClickListener(onClickListener);
    }




}
